package com.ellwood.IPGuard.infrastruction.mapper.system;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ellwood.IPGuard.common.core.basic.MapperFactory;
import com.ellwood.IPGuard.infrastruction.domain.entity.system.UmsSysUserEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * @ProjectName: IPGuard-boot
 * @PackageName: com.ellwood.IPGuard.infrastruction.mapper.system
 * @ClassName: UmsSysUserMapper
 * @Description: // 用户mapper
 * @Author: Ellwood
 * @CreateDate: 2024/9/25 - 下午4:36
 * @Version: V1.0.0
 */
@Mapper
public interface UmsSysUserMapper extends MapperFactory<UmsSysUserEntity> {
        
        /**
         * 获取用户列表-分页查询
         *
         * @param pageParams 分页参数集合
         * @return 返回分页结果
         */
        List<UmsSysUserEntity> getUserList(Map<String, Object> pageParams);
        
        /**
         * 逻辑删除
         *
         * @param userId 用户id
         * @return 返回删除结果
         */
        int userLogicRemove(@Param("userId") Long userId);
        
        
        default UmsSysUserEntity getByUsername(String username) {
                return this.selectOne(new LambdaQueryWrapper<UmsSysUserEntity>().eq(UmsSysUserEntity::getUsername, username));
        }
        
        default UmsSysUserEntity getByMobile(String mobile) {
                return this.selectOne(new LambdaQueryWrapper<UmsSysUserEntity>().eq(UmsSysUserEntity::getMobile, mobile));
        }
        
        
}
